/**
 * 
 */
package hm.base.service;

import java.util.List;

import com.trendytech.tds.common.bean.Pager;

/**
 * @author Hai
 *
 */
public interface IBaseService<T> {

	/**
	 * Insert an entity
	 * @param entity
	 * @return
	 */
	public int insert(T entity);
	
	/**
	 * Update an entity
	 * @param entity
	 * @return
	 */
	public int update(T entity);
	
	/**
	 * Insert/Update an entity
	 * @param entity
	 * @return
	 */
	public int save(T entity);
	
	/**
	 * @return
	 */
	public List<T> getAll();
	
	/**
	 * @param id
	 * @return
	 */
	public T getById(String id);
	
	/**
	 * @param pager
	 * @return
	 */
	public List<T> getByPager(Pager<T> pager);
	
	/**
	 * Remove the record from db directly
	 * @param id
	 * @return
	 */
	public int delete(String id);
	
	/**
	 * Change the record status to "deleted" 
	 * @param entity
	 * @return
	 */
	public int deleteLogical(T entity);
}
